import { useState } from "react";
import usePrevious from ".";

export default function PreviousComponent() {
  const [count, setCount] = useState(0);
  const [name, setName] = useState('Jetwang');
  const previousCount = usePrevious(count);

  return (
    <div>
      <div>{count} - {previousCount}</div>
      <div>Name: {name}</div>
      <button onClick={() => setCount(currentCount => currentCount + 1)}>Increment</button>
      <button onClick={() => setName("John")}>Change Name</button>
    </div>
  )
}